package com.alibaba.mapper;

import com.alibaba.bean.RankListData;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface RankMapper {

    @Select(value = "select user.userId,user.username,user.avatar,rank.* from user left join rank on user.userId=rank.userId where rank.faceValue!=0 order by faceValue DESC limit #{pagelow},#{pagehigh}")
    List<RankListData> rankAll(int pagelow, int pagehigh);

    @Select(value = "select r.faceValue from rank r order by r.faceValue DESC limit 9,1")
    @Results
            ({@Result(property = "faceValue",column = "faceValue")})
    float findTopValue();
}
